package com.wildfire.dao;


import com.wildfire.dto.ProductDto;
import java.util.List;
import org.apache.ibatis.annotations.*;

@Mapper
public interface ProductDao {
    @Select("select * from t_product")
    List<ProductDto> getProductList();

    @Select("select * from t_product where id=#{id}")
    ProductDto geProductById(long id);

    @Select("select amount FROM t_product where id=#{id} FOR UPDATE")
    int queryStock(long id);

    @Update("update t_product set amount=amount-1 where id=#{id}")
    void descStock(long id);

}
